#include <map>
#include "..\phlogger\ProcessInfo.h"

using namespace std;

extern map<long,CProcessInfo> process_map;
extern vector<int> missing_executable;

void RefreshThread()
{
	while(true)
	{
		Sleep(1000);
		for(vector<int>::iterator it=missing_executable.begin(); it!=missing_executable.end();it++)// iterate smaller collection just of ones with missing
		{
			map<long,CProcessInfo>::iterator pmi= process_map.find(*it);
			if(pmi!=process_map.end())
			{
				CProcessInfo temp=pmi->second;
				temp.GetExecutableImage(false);
				if(!temp._path.empty())
				{
					process_map.erase(*it);
					process_map.insert(pair<long,CProcessInfo>(*it,temp));
					long PID=*it;
					missing_executable.erase(it);
					break;
				}
			}
		}
	}
}